package org.ring.common.transport;

import io.netty.buffer.ByteBuf;

import org.ring.common.extension.ExtensionLoader;
import org.ring.common.extension.Extensions;

import java.io.IOException;

/**

 * @since 2023-10-27 11:45
 */
public interface Codec<T> {

    ExtensionLoader<Codec> EXTENSION_LOADER = Extensions.getExtensionLoader(Codec.class);

    void encode(T obj, ByteBuf buf) throws IOException;

    T decode(ByteBuf buf) throws IOException;
}
